package com.xy.api.model.response;


import java.util.List;

public class R<T> {

    public int code;

    private String msg;

    private T data;

    public R(String msg) {
        this.msg = msg;
    }

    public R(T data) {
        this.code = 200;
        this.data = data;
    }

    public R(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static <T> R list(List<T> list, Long total) {
        Rows<T> row = new Rows();
        row.setRows(list);
        row.setTotal(total);
        return new R(row);
    }
}

